﻿<%@ Page Language="C#" MasterPageFile="~/MasterAdmin.Master" AutoEventWireup="true" CodeBehind="QuanLyPhiVanChuyen.aspx.cs" Inherits="EC21_EDiamond.Admin.QuanLyPhiVanChuyen" %>


<asp:Content ID="Content1" runat="server" contentplaceholderid="HeadContent">
    <script type="text/javascript">
        function allownumbers(e) {
            var key = window.event ? e.keyCode : e.which;
            var keychar = String.fromCharCode(key);
            var reg = new RegExp("[0-9.]")
            if (key == 8) {
                keychar = String.fromCharCode(key);
            }
            if (key == 13) {
                key = 8;
                keychar = String.fromCharCode(key);
            }
            return reg.test(keychar);
        };
    </script>
    <table style="width: 100%;">
        <tr>
            <td colspan="2" class="text-center" style="font-size: xx-large; color: #0000FF"><strong>QUẢN LÝ PHÍ VẬN CHUYỂN</strong></td>
        </tr>
        <tr>
            <td style="width: 405px; text-align: right;" class="text-right">Tên tỉnh:</td>
            <td class="text-left">
                 <asp:TextBox ID="txtTenTinh" runat="server" Width="170px" placeholder="Tên tỉnh"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ControlToValidate="txtTenTinh" ErrorMessage="Không để trống!" style="color: #FF0000"></asp:RequiredFieldValidator>
            </td>
        </tr>
         <tr>
            <td style="width: 405px; text-align: right;" class="text-right">Phí vận chuyển:</td>
            <td class="text-left">
                 <asp:TextBox ID="txtPhiVanChuyen" runat="server" Width="170px" placeholder="Phí vận chuyển" onkeypress="javascript:return allownumbers(event);"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtPhiVanChuyen" ErrorMessage="Không để trống!" style="color: #FF0000"></asp:RequiredFieldValidator>
            </td>
        </tr>
         <tr>
             <td></td>
             <td class="text-left">
                 <asp:Button ID="btnThemTinh" runat="server" Text="Thêm" Width="93px" OnClick="btnThemTinh_Click"/></td>
         </tr>
    </table>
    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="4" DataKeyNames="MaTinh" DataSourceID="SqlDataSource1" ForeColor="Black" GridLines="Horizontal" Width="100%">
        <Columns>
            <asp:BoundField DataField="MaTinh" HeaderText="Mã tỉnh" ReadOnly="True" SortExpression="MaTinh" />
            <asp:BoundField DataField="TenTinh" HeaderText="Tên tỉnh" SortExpression="TenTinh" />
            <asp:BoundField DataField="PhiVanChuyen" HeaderText="Phí vận chuyển" SortExpression="PhiVanChuyen" />
            <asp:CommandField ShowEditButton="True" />
        </Columns>
        <FooterStyle BackColor="#CCCC99" ForeColor="Black" />
        <HeaderStyle BackColor="#333333" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="White" ForeColor="Black" HorizontalAlign="Right" />
        <SelectedRowStyle BackColor="#CC3333" Font-Bold="True" ForeColor="White" />
        <SortedAscendingCellStyle BackColor="#F7F7F7" />
        <SortedAscendingHeaderStyle BackColor="#4B4B4B" />
        <SortedDescendingCellStyle BackColor="#E5E5E5" />
        <SortedDescendingHeaderStyle BackColor="#242121" />
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConflictDetection="CompareAllValues" ConnectionString="<%$ ConnectionStrings:aspnetdbConnectionString %>" DeleteCommand="DELETE FROM [Tinh] WHERE [MaTinh] = @original_MaTinh AND (([TenTinh] = @original_TenTinh) OR ([TenTinh] IS NULL AND @original_TenTinh IS NULL)) AND (([PhiVanChuyen] = @original_PhiVanChuyen) OR ([PhiVanChuyen] IS NULL AND @original_PhiVanChuyen IS NULL))" InsertCommand="INSERT INTO [Tinh] ([MaTinh], [TenTinh], [PhiVanChuyen]) VALUES (@MaTinh, @TenTinh, @PhiVanChuyen)" OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT * FROM [Tinh]" UpdateCommand="UPDATE [Tinh] SET [TenTinh] = @TenTinh, [PhiVanChuyen] = @PhiVanChuyen WHERE [MaTinh] = @original_MaTinh AND (([TenTinh] = @original_TenTinh) OR ([TenTinh] IS NULL AND @original_TenTinh IS NULL)) AND (([PhiVanChuyen] = @original_PhiVanChuyen) OR ([PhiVanChuyen] IS NULL AND @original_PhiVanChuyen IS NULL))">
        <DeleteParameters>
            <asp:Parameter Name="original_MaTinh" Type="Int32" />
            <asp:Parameter Name="original_TenTinh" Type="String" />
            <asp:Parameter Name="original_PhiVanChuyen" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="MaTinh" Type="Int32" />
            <asp:Parameter Name="TenTinh" Type="String" />
            <asp:Parameter Name="PhiVanChuyen" Type="Int32" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="TenTinh" Type="String" />
            <asp:Parameter Name="PhiVanChuyen" Type="Int32" />
            <asp:Parameter Name="original_MaTinh" Type="Int32" />
            <asp:Parameter Name="original_TenTinh" Type="String" />
            <asp:Parameter Name="original_PhiVanChuyen" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>
</asp:Content>



